package com.osmino.contacts.list;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import com.osmino.contacts.R;

public abstract class ContactViewBaseItem extends FrameLayout implements OnClickListener{
	
	protected TextView tv1, tv2;
	protected ImageView iv1, iv2;
	protected IContactViewController mController;
	
	public ContactViewBaseItem(Context context, IContactViewController controller) {
		super(context);
		LayoutInflater.from(context).inflate(R.layout.contact_view_base_item, this);
		mController = controller;
		tv1 = (TextView) findViewById(R.id.contact_view_tv1);
		tv2 = (TextView) findViewById(R.id.contact_view_tv2);
		iv1 = (ImageView) findViewById(R.id.contact_view_iv1);
		iv2 = (ImageView) findViewById(R.id.contact_view_iv2);
		iv1.setOnClickListener(this);
		iv2.setOnClickListener(this);
		setImagesTo(iv1, iv2);
	}
	
	public void setText1(String text){
		if(!TextUtils.isEmpty(text))
			tv1.setText(text);
	}
	
	public void setText2(String text){
		if(!TextUtils.isEmpty(text))
			tv2.setText(text);
	}
	
	public abstract void setImagesTo(ImageView iv1, ImageView iv2);
}
